package com.o2o.app.adapter;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.o2o.app.R;
import com.o2o.app.bean.NewspaperBean;

public class CommentListAdapter extends BaseAdapter {
	private Context context;
	private List<NewspaperBean> list;

	public CommentListAdapter(Context context, List<NewspaperBean> list) {
		this.context = context;
		this.list = list;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return list.size();
	}

	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return list.get(arg0);
	}

	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(final int arg0, View arg1, ViewGroup arg2) {
		// TODO Auto-generated method stub
		Myhold mh = null;
		if (arg1 == null) {
			mh = new Myhold();
			arg1 = LayoutInflater.from(context).inflate(
					R.layout.mine_desclose_lly, null);
			mh.tv_name = (TextView) arg1.findViewById(R.id.tv_name);
			mh.tv_time02 = (TextView) arg1.findViewById(R.id.tv_time02);
			mh.tv_infotitle = (TextView) arg1.findViewById(R.id.tv_infotitle);
			mh.tv_des = (TextView) arg1.findViewById(R.id.tv_des);

			mh.iv_touxiang = (ImageView) arg1.findViewById(R.id.iv_touxiang);
			mh.iv_picinfo = (ImageView) arg1.findViewById(R.id.iv_picinfo);
			mh.tv_time = (TextView) arg1.findViewById(R.id.tv_time);

			arg1.setTag(mh);
		} else {
			mh = (Myhold) arg1.getTag();
		}

		mh.tv_time.setVisibility(View.GONE);

		return arg1;
	}

	class Myhold {
		ImageView iv_touxiang, iv_picinfo;
		TextView tv_name, tv_time02, tv_infotitle, tv_des, tv_time;
	}

}
